import sys
from PySide import QtGui, QtCore

class Example(QtGui.QWidget):

    def __init__(self):
        super(Example, self).__init__()

        self.lbl = QtGui.QLabel(self)
        self.lineEdit = QtGui.QLineEdit(self)

        self.lineEdit.move(60, 100)
        self.lbl.move(60, 40)

        # When text is changed, pass the text argument to the function named "updateLabel"
        self.lineEdit.textChanged[str].connect(self.updateLabel)

        self.setGeometry(300, 300, 280, 170)
        self.setWindowTitle('QtGui.QLineEdit')

    def updateLabel(self, text):
        self.lbl.setText(text)
        self.lbl.adjustSize()   # Automatically adjust the size of label as text is entered or removed

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    ex = Example()
    ex.show()
    sys.exit(app.exec_())

